package edu.jd.software.web.backend.controller;

import edu.jd.software.web.backend.common.api.CommonPage;
import edu.jd.software.web.backend.common.api.CommonResult;
import edu.jd.software.web.backend.mbg.model.PmsBrand;
import edu.jd.software.web.backend.service.PmsBrandService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;

import java.util.List;



@Controller
@RequestMapping("/brand")
public class PmsBrandController {
    @Autowired
    private PmsBrandService brandService;

    private static final Logger LOGGER = LoggerFactory.getLogger(PmsBrandController.class);

    @RequestMapping(value = "/listAll", method = RequestMethod.GET)
    @ResponseBody
    public CommonResult<List<PmsBrand>> getBrandList() {
        return CommonResult.failed("未实现");
    }

    @RequestMapping(value = "/create", method = RequestMethod.POST)
    @ResponseBody
    public CommonResult createBrand(@RequestBody PmsBrand pmsBrand) {
        return CommonResult.failed("未实现");
    }

    @RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
    @ResponseBody
    public CommonResult updateBrand(@PathVariable("id") Long id, @RequestBody PmsBrand pmsBrandDto) {
        return CommonResult.failed("未实现");
    }

    @RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
    @ResponseBody
    public CommonResult deleteBrand(@PathVariable("id") Long id) {
        return CommonResult.failed("未实现");
    }

    @RequestMapping(value = "/list", method = RequestMethod.GET)
    @ResponseBody
    public CommonResult<CommonPage<PmsBrand>> listBrand(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                        @RequestParam(value = "pageSize", defaultValue = "3") Integer pageSize) {
        return CommonResult.failed("未实现");
    }

    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
    @ResponseBody
    public CommonResult<PmsBrand> brand(@PathVariable("id") Long id) {
        return CommonResult.failed("未实现");
    }

    /*根据品牌名字name删除品牌*/
    @GetMapping("/deleteByName")
    @ResponseBody
    public CommonResult deleteByName(@RequestParam String name) {
        return CommonResult.failed("未实现");
    }

    /*查询数量小于等于count的品牌*/
    @GetMapping("/listCountLeq")
    @ResponseBody
    public CommonResult listCountLeq(@RequestParam Integer count) {
        return CommonResult.failed("未实现");
    }

}
